package com.afinal.intelligencetrash.Model.bean;

import com.afinal.intelligencetrash.utils.SimpleUtil;
import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by cyy on 17-10-8.
 */

public class User {
    private String username;
    private String pwd;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public static User fromJson(String json){
        Gson gson = SimpleUtil.getGsonInstance();
        return gson.fromJson(json, User.class);
    }

    public String toJson() {
        HashMap<String, String> map = new HashMap<>();
        map.put("username", username);
        map.put("pwd",pwd);
        return SimpleUtil.generateJsonFromMap(map);
    }
}
